{include file="header.html"}
<body class="gr">

<div class="navBar">
	<a class="left" href="javascript:history.back()"><i class="return"></i></a>
	<div class="titleView-x">社保资讯</div>
	<a class="right" href="wap.php?app=home&act=index"><i class="home"></i></a>
</div>

<div class="article-index main-padding-top">
	<div class="pullRefresh">
		<ul class="list">
			{foreach from=$data.articles item=g}
			<li class="ge-bottom"><a href="?app=article&act=detail&id={$g->id}">{$g->title}<span class="scale11-left">{$g->add_time}</span></a></li>
			{foreachelse}
			<div class="norecord">没有任何记录</div>
			{/foreach}
		</ul>
	</div>
</div>

{include file="footer.html"}
<script>
var offset = $('.pullRefresh .list > li').length;
function createHtml(g){
	var html = '<li class="ge-bottom"><a href="?app=article&act=detail&id='+g.id+'">'+g.title+'<span class="scale11-left">'+g.add_time+'</span></a></li>';
	offset++;
	return html;
}
$(function(){
	$('body, .article-index').addClass('height-wrap');
	$('.pullRefresh').pullRefresh({
		header : true,
		footer : true,
		footerNoMoreText : '- END -',
		refresh : function(fn){
			var _this = this;
			offset = 0;
			$.getJSON('api.php?app=article&act=index', function(json){
				if(json.error!=0){ $.overloadError(json.msg);return }
				var html = '';
				if($.isArray(json.data.articles))for(var i=0; i<json.data.articles.length; i++)html += createHtml(json.data.articles[i]);
				_this.find('.list').html(html);
				fn();
			});
		},
		load : function(fn){
			var _this = this;
			$.getJSON('api.php?app=article&act=index', { offset:offset }, function(json){
				if(json.error!=0){ $.overloadError(json.msg);return }
				var html = '';
				if($.isArray(json.data.articles))for(var i=0; i<json.data.articles.length; i++)html += createHtml(json.data.articles[i]);
				_this.find('.list').append(html);
				fn();
			});
		}
	});
});
</script>